home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / termsorc.lha / Extras / Source / gtlayout-source.lha / LTP_Draw.c < prev    next >
C/C++ Source or Header  |  1995-09-24  |  3KB  |  112 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1995 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. VOID __regargs
  10. LTP_DrawBevelBox(LayoutHandle *handle,ObjectNode *node)
  11. {
  12.     DrawBevelBox(&handle -> RPort,node -> Left,node -> Top,node -> Width,node -> Height,
  13.         GT_VisualInfo,    handle -> VisualInfo,
  14.         GTBB_Recessed,    TRUE,
  15.     TAG_DONE);
  16. }
  17.  
  18.  
  19. /*****************************************************************************/
  20.  
  21.  
  22. VOID __regargs
  23. LTP_PlaceText(LayoutHandle *handle,STRPTR text,ULONG textLen,LONG x,LONG y)
  24. {
  25.     Move(&handle -> RPort,x,y);
  26.     Text(&handle -> RPort,text,textLen);
  27. }
  28.  
  29.  
  30. /*****************************************************************************/
  31.  
  32.  
  33. VOID __regargs
  34. LTP_TunnelDraw(struct RastPort *rp,LONG from,LONG to,LONG y,LONG left,LONG right)
  35. {
  36.     Draw(rp,from,y);
  37.     Draw(rp,left - 1,y);
  38.     Move(rp,right + 1,y);
  39.     Draw(rp,to,y);
  40. }
  41.  
  42.  
  43. /*****************************************************************************/
  44.  
  45.  
  46. VOID __regargs
  47. LTP_DrawGroove(LayoutHandle *handle,LONG left,LONG top,LONG width,LONG height,LONG from,LONG to)
  48. {
  49.     struct RastPort *rp = &handle -> RPort;
  50.  
  51.     LTP_SetAPen(rp,handle -> ShadowPen);
  52.  
  53.     Move(rp,left + 1,top + 1);
  54.     Draw(rp,left + 1,top + height - 2);
  55.     Draw(rp,left,top + height - 1);
  56.     LTP_TunnelDraw(rp,left,left + width - 2,top,from,to);
  57.     Draw(rp,left + width - 4,top + 2);
  58.     Draw(rp,left + width - 4,top + height - 3);
  59.     Move(rp,left + width - 3,top + 2);
  60.     Draw(rp,left + width - 3,top + height - 2);
  61.     Draw(rp,left + 3,top + height - 2);
  62.  
  63.     LTP_SetAPen(rp,handle -> ShinePen);
  64.     Move(rp,left + width - 2,top + height - 2);
  65.     Draw(rp,left + width - 2,top + 1);
  66.     Draw(rp,left + width - 1,top);
  67.     Draw(rp,left + width - 1,top + height - 1);
  68.     Draw(rp,left + 1,top + height - 1);
  69.     Draw(rp,left + 3,top + height - 3);
  70.     Draw(rp,left + 3,top + 2);
  71.     Move(rp,left + 2,top + height - 3);
  72.     LTP_TunnelDraw(rp,left + 2,left + width - 4,top + 1,from,to);
  73. }
  74.  
  75.  
  76. /*****************************************************************************/
  77.  
  78.  
  79. VOID __regargs
  80. LTP_DrawLabel(LayoutHandle *handle,ObjectNode *label)
  81. {
  82.     struct RastPort *rp;
  83.     LONG         left;
  84.  
  85.     left    = label -> Left + (label -> Width - label -> LabelWidth) / 2;
  86.     rp    = &handle -> RPort;
  87.  
  88.     LockLayerRom(rp -> Layer);
  89.  
  90.     if(label -> Label)
  91.     {
  92.         WORD y,to;
  93.  
  94.         LTP_DrawGroove(handle,label -> Left + handle -> GlyphWidth / 2,y = label -> Top + handle -> RPort . TxHeight / 2,label -> Width - handle -> GlyphWidth,label -> Height - (handle -> RPort . TxHeight + handle -> InterHeight) / 2,left,to = left + label -> LabelWidth - 1);
  95.  
  96.         LTP_SetAPen(rp,handle -> ShinePen);
  97.         Move(rp,left,y);
  98.         Draw(rp,left,y+1);
  99.  
  100.         LTP_SetAPen(rp,handle -> ShadowPen);
  101.         Move(rp,to,y);
  102.         Draw(rp,to,y+1);
  103.  
  104.         LTP_SetPens(rp,handle -> DrawInfo -> dri_Pens[HIGHLIGHTTEXTPEN],0,JAM1);
  105.         LTP_PlaceText(handle,label -> Label,strlen(label -> Label),left + handle -> GlyphWidth,label -> Top + handle -> RPort . TxBaseline);
  106.     }
  107.     else
  108.         LTP_DrawGroove(handle,label -> Left + handle -> GlyphWidth / 2,label -> Top,label -> Width - handle -> GlyphWidth,label -> Height - handle -> InterHeight / 2,left,left + label -> LabelWidth - 1);
  109.  
  110.     UnlockLayerRom(rp -> Layer);
  111. }
  112.